﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner : MonoBehaviour
{
    //方块类型
    public GameObject[] gO;
    // Start is called before the first frame update
    void Start()
    {
        SpawnBorn();
    }

    // Update is called once per frame
    void Update()
        {
        
    }

    //方块模型生成方法
    void SpawnBorn() {
        int length = gO.Length;
        //as的用法，如果转换失败，为NULL，而不会报异常。
        GameObject obj = Instantiate(gO[Random.Range(0,length)],this.gameObject.transform.position,Quaternion.identity) as GameObject;
    }
}
